/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package apartmentBean;

import bo.ApartmentBus;
import domain.pojo.Apartment;
import java.sql.Date;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author lion
 */
@ManagedBean
@RequestScoped
public class ApartmentBean {

    private Apartment apartment;
    private ApartmentBus apartmentBus;

     public ApartmentBean() {
        this.apartment = new Apartment();
        this.apartmentBus = new ApartmentBus();
    }

    public Apartment getApartment() {
        return apartment;
    }

    public void setApartment(Apartment apartment) {
        this.apartment = apartment;
    }

    public ApartmentBus getApartmentBus() {
        return apartmentBus;
    }

    public void setApartmentBus(ApartmentBus apartmentBus) {
        this.apartmentBus = apartmentBus;
    }
    
    public Integer addApartment()
    {
        apartment.setCreated(new Date(System.currentTimeMillis()));
        apartment.setCreator("duongpb");
        return apartmentBus.getApartmentDaoImpl().insertApartment(apartment);
    }
}
